package pl.asoft.nbp.dao;

import pl.asoft.nbp.model.PersistentObject;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * Interface for Generic DAO.
 * Created by rbiedrawa on 2014-12-02.
 */
public interface PersistentObjectDAO<T extends PersistentObject<ID>, ID extends Serializable> {

    T save(T entity);
    void save(List<T> listOfEntitys);

    T find(ID id);
    List<T> findAll();

    T update(T entity);

    void delete(ID id);

    List findByNamedQuery(String queryName);
    List findByNamedQuery(String queryName, int resultLimit);
    List findByNamedQuery(String namedQueryName, Map parameters);
    List findByNamedQuery(String namedQueryName, Map parameters, int resultLimit);

    List findByNativeQuery(String nativeQuery, Class clazz);
    List<Object[]> findByNativeQuery(String nativeQuery);

}
